package com.example.demo.service;

import com.example.demo.model.Emp;
import com.example.demo.reposition.EmpReposition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
@CacheConfig(cacheNames = "empCache")
public class EmpService {
    @Autowired
    EmpReposition empReposition;
    @Cacheable
    public List<Emp> findAllEmps(){
        return empReposition.findAll();
    }
    @CacheEvict
    public void evict(){
    }
}
